﻿
@{
    ViewData["Title"] = "changepwd";
    Layout = "~/Views/Shared/_Layout.cshtml";
}


<div class="login layui-anim layui-anim-up" style="width:400px">
    <div class="message">密码修改（为了防止误输，请输入两次。）</div>
    <div id="darkbannerwrap"></div>

    <form method="post" class="layui-form">
        <input name="password" id="password" placeholder="输入新的密码" lay-verify="required" type="password" class="layui-input">
        <hr class="hr15">
        <input name="repassword" id="repassword" placeholder="请再次输入新的密码" lay-verify="required" type="password" class="layui-input">
        <hr class="hr15">
       

        <button  class="layui-btn layui-btn-danger  " lay-filter="changepwd" ><span class="layui-icon layui-icon-user" ></span>修改密码</button>
        <hr class="hr20">
    </form>
</div>


<script>
         $(function () {
             layui.use('form', function () {
                 var form = layui.form;
                 // layer.msg('玩命卖萌中', function(){
                 //   //关闭后的操作
                 //   });
                 //监听提交
                 form.on('submit(changepwd)', function (data) {
                     var ps = $("#password").val();
                     var pss = $("#repassword").val();
                     if (ps != pss) {
                            layer.msg("两次密码输入不一致，请重新输入", { icon: 5, time: 2000 });

                     } else {

                         $.ajax({
                             type: "POST",
                             url: '/Main/changepwd',
                             data: {
                                 pwd:ps,

                             },
                         dataType: "json",
                         success: function (data) {



                                  layer.msg(data.msg, { icon: 5, time: 2000 });
                             
                         }
                         , error: function () {
                              layer.msg("登陆请求失败，请再次尝试，或者检查网络", { icon: 5, time: 2000 });
                       // alert("登陆请求失败，请再次尝试，或者检查网络");
                    }


                     });

                     }

                    

                     return false;//重点  不然会提交2次表单
                 });
             });
         })
</script>
<!-- 底部结束 -->
